"""

@author: lingw
@email: gw.lin@hzgosun.com
@file: camaraListPage.py
@time: 2019-5-10 下午 4:04

这一行开始写关于本文件的说明与解释

"""

from common.poium import Page
from common.vue.float_window import FloatWindow
from common.vue.table import VueTable, VueTurnPage
from common.vue.label import ElementType as ET
from common.vue.label import ElementBaseLabel
from common.vue.search import VueSearch
from common.vue.tree import VueTree
from common.vue.region import VueRegion
from common.vue.button import VueButton
from common.vue.element import VueElements

class SearchTools(VueSearch):
    """查询区域"""
    keyword_dropdown_list = ElementBaseLabel(ET.DROPDOWN_LIST, label="关键字")
    keyword_input = ElementBaseLabel(ET.INPUT, label="关键字")

    region_select_btn = ElementBaseLabel(ET.REGION, label="区域")
    region_selector = VueRegion(index=0)

    communicity_dropdown_list =  ElementBaseLabel(ET.DROPDOWN_LIST, label="小区")

    search_btn = VueButton("检索")

    def __init__(self):
        super(SearchTools, self).__init__()


class Table(VueTable):
    """摄像机列表"""

    add_btn = VueButton("添加")
    import_btn = VueButton("导入")

    def __init__(self):
        super(Table, self).__init__()

class AddCamWindow(FloatWindow):
    """添加摄像机窗口"""

    camera_account = ElementBaseLabel(ET.INPUT, label="摄像机账号")
    password = ElementBaseLabel(ET.INPUT, label="密码")
    camera_number = ElementBaseLabel(ET.INPUT, label="摄像机编号")
    cameraIP = ElementBaseLabel(ET.INPUT, label="摄像机IP")
    camera_type = ElementBaseLabel(ET.DROPDOWN_LIST, label="摄像机类别")
    camera_name = ElementBaseLabel(ET.INPUT, label="摄像机名称")

    region_add_btn = ElementBaseLabel(ET.REGION, label="区域")
    region_add_selector = VueRegion(index=1)
    communicity_list = ElementBaseLabel(ET.DROPDOWN_LIST, label="小区")
    bind_electricity_fence = ElementBaseLabel(ET.DROPDOWN_LIST, label="绑定电围")

    platform_id = ElementBaseLabel(ET.INPUT, label="平台id")

    manufacturer_type = ElementBaseLabel(ET.DROPDOWN_LIST, label="厂商类型")
    camera_model = ElementBaseLabel(ET.DROPDOWN_LIST, label="摄像机型号")
    camera_face = ElementBaseLabel(ET.DROPDOWN_LIST, label="摄像机朝向")

    snap_the_alarm_cap = ElementBaseLabel(ET.INPUT, label="抓拍告警上限")
    capture_the_lower_alarm_limit = ElementBaseLabel(ET.INPUT, label="抓拍告警下限")

    GIS = ElementBaseLabel(ET.INPUT, label="GIS")

    #地图内输入关键字搜索，暂时没什么屌用
    keywords_search = ElementBaseLabel(ET.INPUT, label="请输入关键字（选定后搜索）")

    def __init__(self, title=None, index=None):
        super(AddCamWindow, self).__init__(title=title, index=index)

class ModifyCamWindow(AddCamWindow):
    """修改摄像机窗口"""

    modify_btn = VueButton("修改")

    def __init__(self, title=None, index=None):
        super(ModifyCamWindow, self).__init__(title=title, index=index)

class DeleteCam(FloatWindow):
    """删除摄像机窗口"""

    delect_btn = VueButton('确认')

    def __init__(self, title=None, index=None):
        super(DeleteCam, self).__init__(title=title, index=index)

class ImputCamWindow(FloatWindow):
    """导入摄像机窗口"""

    select_imput = ElementBaseLabel(ET.UPLOAD, label='选择EXCEL文档')
    imput_btn = VueButton('导入')

    def __init__(self, title=None, index=None):
        super(ImputCamWindow, self).__init__(title=title, index=index)

class CamListPage(Page):
    """摄像机管理页面"""

    searchTools = SearchTools()   # 查询区域
    table = Table()   # 列表
    turnPage = VueTurnPage()   # 翻页
    addCam = AddCamWindow(title="添加摄像机")   # 添加摄像机弹窗
    modifyCam = ModifyCamWindow(title="摄像机详情")   # 修改摄像机弹窗
    deleteCam = DeleteCam(title='删除确认')
    importCam = ImputCamWindow(title='导入')


